/*     */ package com.jcrj.action.system;
/*     */ 
/*     */ import com.jcrj.action.BaseAction;
/*     */ import com.jcrj.entity.ORole;
/*     */ import com.jcrj.entity.OUser;
/*     */ import com.jcrj.service.RoleService;
/*     */ import com.jcrj.service.SysLogService;
/*     */ import java.io.IOException;
/*     */ import java.io.PrintWriter;
/*     */ import java.util.Date;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ 
/*     */ public class RoleAction extends BaseAction
/*     */ {
/*     */   private RoleService roleService;
/*     */   private String account;
/*     */   private String name;
/*     */   private List<ORole> roleList;
/*     */   private long pageCount;
/*     */   private long totalCount;
/*     */   private ORole role;
/*     */   private String[] ids;
/*     */   private String roleId;
/*     */   private SysLogService sysLogService;
/*     */ 
/*     */   public String roleManager()
/*     */   {
/*  28 */     this.totalCount = this.roleService.getRoleCount(this.name).longValue();
/*  29 */     this.pageCount = ((this.totalCount - 1L) / 10L + 1L);
/*  30 */     if (super.getCurrentPage() > this.pageCount) {
/*  31 */       super.setCurrentPage(Long.valueOf(this.pageCount).intValue());
/*     */     }
/*  33 */     this.roleList = this.roleService.getRoleList(this.name, super.getCurrentPage());
/*  34 */     return "success";
/*     */   }
/*     */ 
/*     */   public String initRole() {
/*  38 */     return "success";
/*     */   }
/*     */ 
/*     */   public String saveRole() {
/*     */     try {
/*  43 */       OUser user = (OUser)getSession().get("userInfo");
/*  44 */       this.role.setCreateTime(new Date());
/*  45 */       this.roleService.saveRole(this.role);
/*  46 */       this.sysLogService.saveLog("角色管理", user.getName(), "添加了" + 
/*  47 */         this.role.getName() + "角色信息");
/*  48 */       super.getResponse().getWriter().write("success");
/*  49 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/*  51 */       e.printStackTrace();
/*     */       try
/*     */       {
/*  54 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e1) {
/*  56 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/*  54 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e) {
/*  56 */         e.printStackTrace();
/*     */       }
/*     */     }
/*  59 */     return null;
/*     */   }
/*     */ 
/*     */   public String getRoleInfo() {
/*  63 */     this.role = this.roleService.getRoleInfo(Integer.parseInt(this.roleId));
/*  64 */     return "success";
/*     */   }
/*     */ 
/*     */   public String updateRole() {
/*     */     try {
/*  69 */       OUser user = (OUser)getSession().get("userInfo");
/*  70 */       this.roleService.updateRole(this.role);
/*  71 */       this.sysLogService.saveLog("角色管理", user.getName(), "修改了" + 
/*  72 */         this.role.getName() + "角色信息");
/*  73 */       super.getResponse().getWriter().write("success");
/*  74 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/*  76 */       e.printStackTrace();
/*     */       try
/*     */       {
/*  79 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e1) {
/*  81 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/*  79 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e) {
/*  81 */         e.printStackTrace();
/*     */       }
/*     */     }
/*  84 */     return null;
/*     */   }
/*     */ 
/*     */   public String deleteRole() {
/*     */     try {
/*  89 */       OUser user = (OUser)getSession().get("userInfo");
/*  90 */       this.roleService.deleteRole(this.ids);
/*  91 */       this.sysLogService.saveLog("角色管理", user.getName(), "删除了角色信息");
/*  92 */       super.getResponse().getWriter().write("success");
/*  93 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/*  95 */       e.printStackTrace();
/*     */       try
/*     */       {
/*  98 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e1) {
/* 100 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/*  98 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e) {
/* 100 */         e.printStackTrace();
/*     */       }
/*     */     }
/* 103 */     return null;
/*     */   }
/*     */ 
/*     */   public String findAllRole() {
/* 107 */     this.roleList = this.roleService.findAllRole();
/* 108 */     return "success";
/*     */   }
/*     */ 
/*     */   public String userRoleYes() {
/* 112 */     return "success";
/*     */   }
/*     */ 
/*     */   public RoleService getRoleService() {
/* 116 */     return this.roleService;
/*     */   }
/*     */ 
/*     */   public void setRoleService(RoleService roleService) {
/* 120 */     this.roleService = roleService;
/*     */   }
/*     */ 
/*     */   public String getName() {
/* 124 */     return this.name;
/*     */   }
/*     */ 
/*     */   public void setName(String name) {
/* 128 */     this.name = name;
/*     */   }
/*     */ 
/*     */   public List<ORole> getRoleList() {
/* 132 */     return this.roleList;
/*     */   }
/*     */ 
/*     */   public void setRoleList(List<ORole> roleList) {
/* 136 */     this.roleList = roleList;
/*     */   }
/*     */ 
/*     */   public long getPageCount() {
/* 140 */     return this.pageCount;
/*     */   }
/*     */ 
/*     */   public void setPageCount(long pageCount) {
/* 144 */     this.pageCount = pageCount;
/*     */   }
/*     */ 
/*     */   public long getTotalCount() {
/* 148 */     return this.totalCount;
/*     */   }
/*     */ 
/*     */   public void setTotalCount(long totalCount) {
/* 152 */     this.totalCount = totalCount;
/*     */   }
/*     */ 
/*     */   public ORole getRole() {
/* 156 */     return this.role;
/*     */   }
/*     */ 
/*     */   public void setRole(ORole role) {
/* 160 */     this.role = role;
/*     */   }
/*     */ 
/*     */   public String[] getIds() {
/* 164 */     return this.ids;
/*     */   }
/*     */ 
/*     */   public void setIds(String[] ids) {
/* 168 */     this.ids = ids;
/*     */   }
/*     */ 
/*     */   public String getRoleId() {
/* 172 */     return this.roleId;
/*     */   }
/*     */ 
/*     */   public void setRoleId(String roleId) {
/* 176 */     this.roleId = roleId;
/*     */   }
/*     */ 
/*     */   public SysLogService getSysLogService() {
/* 180 */     return this.sysLogService;
/*     */   }
/*     */ 
/*     */   public void setSysLogService(SysLogService sysLogService) {
/* 184 */     this.sysLogService = sysLogService;
/*     */   }
/*     */ 
/*     */   public String getAccount() {
/* 188 */     return this.account;
/*     */   }
/*     */ 
/*     */   public void setAccount(String account) {
/* 192 */     this.account = account;
/*     */   }
/*     */ }

/* Location:           /Volumes/work/oa/WEB-INF/classes/
 * Qualified Name:     com.jcrj.action.system.RoleAction
 * JD-Core Version:    0.6.0
 */